//
//  DEWAddFriendViewController.m
//  OtherDemo
//
//  Created by lianjie on 2018/7/25.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "DEWAddFriendViewController.h"
#import "DEWMessageToolsTableCell.h"
@interface DEWAddFriendViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic ,strong) UITableView *table;
///可能认识的好友
@property (nonatomic ,strong) NSMutableArray *friendList;

@end

@implementation DEWAddFriendViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"添加好友";
    [self loadData];
    
    [self createView];
}

#pragma mark ----requestData
-(void)loadData
{
    
    
}
#pragma mark ---initView
-(void)createView
{
    [self.view addSubview:self.table];
    
    
}
#pragma mark ---tableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) {
        return 1;
    }else{
        return 2;
    }
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        
        DEWMessageToolsTableCell *cell = [[DEWMessageToolsTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell01"];
        
        cell.titleLab.textColor = UIColorFromRGB(0x999999);
        cell.titleLab.text = @"搜索手机号、昵称";
        cell.imageV.image = [UIImage imageNamed:@""];
        cell.imageV.backgroundColor = CellLineColor;
        cell.lj_lineWith = 0;
        return cell;
        
    }else if (indexPath.section == 1) {
        DEWMessageToolsTableCell *cell = [[DEWMessageToolsTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.imageV.backgroundColor = CellLineColor;
        if (indexPath.row == 0) {
            cell.imageV.image = [UIImage imageNamed:@""];
            cell.titleLab.text = @"添加手机联系人";
        }else{
            cell.imageV.image = [UIImage imageNamed:@""];
            cell.titleLab.text = @"扫一扫添加好友";
            cell.lj_lineWith = 0;
        }
        
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        
        return cell;
    }else{
        UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        
        cell.textLabel.text = @"可能认识的人";
        return cell;
    }
    
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0 || indexPath.section == 1) {
        return 70.0f;
    }else{
        return 30.0f;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    if (section == 0 || section == 1) {
        return 10.0f;
    }else{
        return 0.001f;
    }
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.001f;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    if (indexPath.section == 0) {
        ///搜索人员
        BaseViewController *vc = [[NSClassFromString(@"DEWSearchFriendController") alloc]init];
        
        [self.navigationController pushViewController:vc animated:YES];
        
    }else if (indexPath.section == 1){
        if (indexPath.row == 0) {
            //手机号添加
           
            BaseViewController *vc = [[NSClassFromString(@"DEWPhoneAddFriendController") alloc]init];
            
            [self.navigationController pushViewController:vc animated:YES];
            
        }else{
            //扫一扫
            
        }
        
    }
    
}

#pragma mark --lazy
-(UITableView *)table
{
    if (!_table) {
        _table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, DEWScreenWidth, DEWScreenHeight-(NAVH)) style:UITableViewStyleGrouped];
        
        _table.delegate = self;
        
        _table.dataSource = self;
        
        _table.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _table;
    
}

-(NSMutableArray *)friendList
{
    if (!_friendList) {
        _friendList = [NSMutableArray array];
    }
    return _friendList;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
